package com.ParkingManager.app.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ParkingManager.app.bean.Cash;
import com.ParkingManager.app.bean.Parking;
import com.ParkingManager.app.service.ManageCashService;
import com.ParkingManager.app.service.ManageService;


@RestController
public class ManageCashController {
	@Autowired
	private ManageCashService manageCashService;
	
	@RequestMapping("/Manage/getCash")
	public List<Cash> getLessons(){
		List<Cash>a= manageCashService.getCash();
		for(int i = 0;i < a.size(); i ++) {
			
			a.get(i).setStartTime(a.get(i).getStartTime().substring(0,a.get(i).getStartTime().length()-2));
		}

	 return a;
	}
	
	@RequestMapping("/Manage/insertCash")
	public boolean insertLessons(Cash cash){
		
	return manageCashService.insertCash(cash);
	}
	
	@RequestMapping("/Manage/updateCash")
	public boolean updateLessons(Cash Cash){
		
	return manageCashService.updateCash(Cash);
	}
	
	@RequestMapping("/Manage/delectCash")
	public boolean delectLessons(int cashFlowId){
		
	return manageCashService.delectCash(cashFlowId);
	}
}
